<script>
    var page_list = "deliverGoodsWeb_list";
    $(function() {
        $("body").layout();
        grid_init($("#grid"),{
            singleSelect: false,
            columns:[[
                { field: 'o.id', checkbox: true, title: '',width: 100},
                { field: 'o.company_code', title: '总代码',width: 100},
                { field: 'o.company_name', title: '公司名称',width: 150},
                { field: 'o.child_web_names', title: '发货网点',width: 500},
                { field: 'o.create_login_name', title: '创建人',width: 100},
                { field: 'o.create_time', title: '创建时间',width: 150},
                { field: 'o.update_login_name', title: '修改人',width: 100},
                { field: 'o.update_time', title: '修改时间',width: 150}
                ]],
            _order:"o.create_time desc",
            _append: [],//隐藏列
            _page: page_list,
            _table: "platform_members.deliver_goods_web as o",
            _db: "slave",
            _exportTitle: "发货网点列表",
            _context_handle: [{
                text: "编辑",
                icon: "icon-edit",
                handle: function(index,row){
                    j_showWin({url:'logistics/deliverGoodsWebSet/edit.html?keyId='+this.getFieldValue(row,"o.company_code"),title:'设置发货网点',iconCls: 'icon-form-edit'})
                }
            },{
                text: "删除",
                //auth: "delete",
                icon: "icon-config-delete",
                handle: function(index,row){
                    var grid = $(this);
                    var self = this;
                    $.messager.confirm('系统提示', '您确认删除该发货网点吗?', function(r){
                        if (r){
                            self.focus();
                            showLoading();
                            fy_api.ajax({
                                url: "deliverGoodsWebSet/delete.do?_t="+new Date().getTime(),
                                data: {"keyIds":self.getFieldValue(row,"o.company_code")},
                                success: function(data){
                                    hideLoading();
                                    if(isSuccess(data)){
                                        j_tip(data.msg,'success');
                                        grid.datagrid("reload");
                                    }else{
                                        $.messager.alert('系统提示',data.msg,'error',function(){
                                            self.focus();
                                        });
                                    }
                                }
                            });
                        }else{
                            self.focus();
                        }
                    });
                }
            }],
            toolbar: '#grid_toolbar',
            searchDiv: '#grid_search'
        });

        $("#btnBatchDelete").click(function(){
            initBatchDelete_2(grid_get("grid"),"deliverGoodsWebSet/delete.do","company_code","companyName");
        });

        $('#deliverGoodsWeb').inputgrid({
            idField: 'o.company_code',
            textField: 'o.companyName',
            searchField: ['o.companyCode', 'o.companyName'],//查询字段多字段匹配
            columns: [[
                {field: 'o.companyCode', title: '总代码'},
                {field: 'o.companyName', title: '公司名'}
            ]],
            _page: parent.page_list,
            _append: [],//隐藏列
            _table: "platform_members.deliver_goods_web as o",
            _db: "slave"
        });
    });

</script>
<div id="grid_search" data-options="region:'north',height:'auto',hideExpandTool: true,hideCollapsedContent: false,collapsedContent:function(){return '查询条件(已隐藏)'}" style="border-top:none;border-left:none;border-right:none;" class="search-form">
    <input type="hidden" name="o.delete_flag" value="0"/>
    <input type="hidden" name="o.is_child_web" value="0"/>
    <div class="div-item">
        <div class="div-label">总代码：</div>
        <input name="o.company_code" type="text" clear/>
    </div>
    <div class="div-item">
        <div class="div-label">公司名：</div>
        <input name="o.company_name" type="text" clear/>
    </div>
</div>
<div data-options="region:'center',title:false,border:false" id="divCenter" style="">
    <table id="grid"></table>
</div>
<div id="grid_toolbar" style="padding:3px;">
    <a href="javascript:void(0)" class="easyui-linkbutton <!--auth-button-->" action="add" data-options="plain:true,iconCls:'icon-config-add'" onclick="j_showWin({url:'logistics/deliverGoodsWebSet/edit.html',title:'添加发货网点设置',iconCls: 'icon-form-add'})">添加</a>
    <a href="javascript:void(0)" class="easyui-linkbutton <!--auth-button-->" action="delete" data-options="plain:true,iconCls:'icon-config-delete'" id="btnBatchDelete">批量删除</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'layout-button-up'" onclick="var button=$(this);if(button.linkbutton('options').iconCls=='layout-button-up'){$('body').layout('collapse','north');button.linkbutton({iconCls:'layout-button-down'})}else{$('body').layout('expand','north');button.linkbutton({iconCls:'layout-button-up'})}button.linkbutton('disable');setTimeout(function(){button.linkbutton('enable');},200)" style="float:right"></a>
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-help'" id="help" style="float:right"></a>
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-button-refresh'" onclick="grid_get('grid')[0].search(true)" style="float:right">重置</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-search'" onclick="grid_get('grid')[0].search()" style="float:right">查询</a>
</div>